-- CALC_IRON_SHEET_BONUS

-- 计算观众铁皮掉落
-- @param user      玩家对象
return function(user)
    local rand = DungeonM.getRandSeed("activities_audience");
    local rand1 = DungeonM.getRandSeed("activities_audience");
    local classId = FormulaM.invoke("FETCH_BY_RAND", { 1102, 1103 }, rand1);
    local classId2 = FormulaM.invoke("FETCH_BY_RAND", { 1104, 1105 }, rand1);
    local arr;
    local arr1;
    local bonus = {};
    local dungeonId = DungeonM.getDungeonId();
    local count;
    local count2;

    -- 不同难度的副本数值不同
    if dungeonId == 20003 then
        count = 20;
        count2 = 10;
    elseif dungeonId == 20002 then
        count = 10;
        count2 = 5;
    else
        count = 5;
        count2 = 2;
    end

    if BuildingBonusM.getFieldStat("iron_sheet_gem") < 2 then
        arr = { { ["bonus"] = { 1, classId, count, }, ["ratio"] = 50, },
                { ["bonus"] = { 1, classId2, count2, }, ["ratio"] = 25, },
                { ["bonus"] = { 2, "gem", 1, }, ["ratio"] = 25, },};
    else
        arr = { { ["bonus"] = { 1, classId, count, }, ["ratio"] = 50, },
                { ["bonus"] = { 1, classId2, count2, }, ["ratio"] = 25, },};
    end

    arr1 = fetchElemBySeed(arr, rand);
    bonus  = arr1["bonus"];

    -- 当前累计的奖励钻石
    -- 添加统计
    if bonus[2] == "gem" then
       BuildingBonusM.addFieldStat("iron_sheet_gem", bonus[3]);
    end

    return bonus;
end
